<%@ page pageEncoding="UTF-8"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<jsp:include page="admin/common/Userheader.jsp"></jsp:include>
<!-- <script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script> -->
<link href="${pageContext.request.contextPath}/views/js/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/views/js/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
<script src="${pageContext.request.contextPath}/views/js/ligerUI/js/core/base.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/views/js/ligerUI/js/plugins/ligerDrag.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/views/js/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/views/js/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/views/js/utils.js" type="text/javascript"></script>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>文件管理</title>
		<link rel="stylesheet" href="${pageContext.request.contextPath}/views/css/system.css" />
	</head>
	<body>
		<div>
			<input type="hidden" id="selFolder">
		</div>
		<div class="wapper">
			<!--左侧-->
			<div class="left">
				<!--logo-->
				<div class="logo">
					<img src="images/logo.png"/>
				</div>
				
				<!--列表-->
				<div class="main">
					<div class="search">
						<input type="text" name="text" value="" placeholder="搜索部门"/>
						<!--<span>搜索部门</span>-->
						
					</div>
					
					<ul class="frist">
						<li class="current"><a href="###">北京桑德新环卫投资有限公司</a>
							<ul class="second">
								<li><a hreef="###">云平台技术部</a>
									<ul class="three">
										<li><a href="###">张小仙</a>
											<ul class="four">
												<li><a href="###">张小仙</a></li>
											</ul>
										</li>
									</ul>
								</li>
							</ul>
						</li>
						<li><a href="###">公共物业管理</a></li>
						<li><a href="###">好嘞技术研发部</a></li>
						<li><a href="###">好嘞社区商城部</a></li>
					</ul>
					
				</div>
			</div>
			
			<!--右侧-->
			<div class="right">
				<!--头部-->
				<div class="title">
					<a href="###">修改密码</a>
					<div class="user_info">
						<img src="images/user.png"/>
						<span>用户名称</span>
						<span>部门名称</span>
					</div>
				</div>
				
				<!--内容-->
				<div class="content">
					<!--工具栏-->
					<div class="tool">
						<div class="tool_left">
							<a href="###" onclick="f_openfolder();">新建文件夹</a>
							<a href="###" class="up" onclick="f_upload();">上传文件</a>
						</div>
						
						<div class="tool_right">
							<input type="text" placeholder="搜索您的文件"/>
							<p>文件数：<span>123</span></p>
							<p>总大小：<span>123</span></p>
						</div>
					</div>
					
					<!--表格内容-->
					<table border="0" cellspacing="0" cellpadding="0">
						<thead>
							<tr>
								<th><input type="checkbox"></th>
								<th align="left" style="padding-left: 28px;"><a href="https://www.baidu.com">文件名</a></th>
								<th>大小</th>
								<th></th>
								<th>属性</th>
								<th>修改日期</th>
								<th>修改者</th>
							</tr>
							<tbody id="tb_body">
								<tr>
									<td width="63" align="center"><input type="checkbox"></td>
									<td width="182" align="left"><span class="zip">ui设计图</span></td>
									<td width="130" align="center">122M</td>
									<td width="93" align="center"><a href="###"><img src="images/share.png"/></a><a href="###"><img src="images/download.png"></a></td>
									<td width="68" align="center">公开</td>
									<td width="334" align="center">2016-03-12  10:24</td>
									<td align="center">小钟</td>
								</tr>
								<tr>
									<td  align="center"><input type="checkbox"></td>
									<td align="left"><span class="folder">ui设计图</span></td>
									<td  align="center">122M</td>
									<td  align="center"><a href="###"><img src="images/share.png"/></a><a href="###"><img src="images/download.png"></a></td>
									<td  align="center">公开</td>
									<td  align="center">2016-03-12  10:24</td>
									<td  align="center">小钟</td>
								</tr>
							</tbody>
						</thead>
					</table>
					<div id="kkpager"></div>
					<!--翻页-->
					<ul class="page">
						<li class="img"><a href="###"><img src="images/next.png"/></a></li>
						<li><a href="###">10</a></li>
						<li><a href="###">...</a></li>
						<li><a href="###">4</a></li>
						<li class="current"><a href="###">3</a></li>
						<li><a href="###">2</a></li>
						<li><a href="###">1</a></li>
						<li class="img"><a href="###"><img src="images/pageup.png"/></a></li>
					</ul>
				</div>
			</div>
			
		</div>
		
	</body>
	<script type="text/javascript">
		
		$(function(){
			auto();
			
			//计算宽高度
			function auto(){
				var winH = $(window).height(); //获取浏览器的高度
				$('.left').css('height',winH);   //左侧的高度
				$('#tb_body').empty();
			}
			
			BindData(1);
			
		})
		
		
		function BindData(pageIndex){
			$.ajax({
				type : "post",
				url : "${pageContext.request.contextPath}/file/ajaxselectdepartfileslist",
				data : {
					page:pageIndex,
					size:20,
					departmentId:"11",
					departmentCode:"haolei"
					
				},
				dataType : "json",
				success : function(data) {
					if(data){
						var curPageIndex = data.curPage;//当前页码
						var total = data.total;//数据总条数
						var totalPage = data.totalPage;//页面总数
						if(data.data){
							var msg = data.data;
							$('#tb_body').empty();
							
							$.each(data.data,function(i, item) {
								var dateVal = "";
								if (item.rtime != null
										&& item.rtime != "") {
									var dateV = new Date();
									dateV.setTime(item.rtime);
									dateVal = dateV
											.Format('yyyy-MM-dd hh:mm:ss');
	
								}
								
								var htmlCon = "<tr>"+
													"<td  align='center'><input type='checkbox'></td>"+
													"<td align='left'><span class='folder'><a onclick=BindData(1)>"+item.fileName+item.fileSuffix+"</a></span></td>"+
													"<td  align='center'>"+item.fileSize+"</td>"+
													"<td  align='center'><a href='###'><img src='images/share.png'/></a><a href='###'><img src='images/download.png'></a></td>"+
													"<td  align='center'>"+item.fileCharacter+"</td>"+
													"<td  align='center'>"+dateVal+"</td>"+
													"<td  align='center'>"+item.users.username+"</td>"+
												"</tr>";
								$("#tb_body").append(htmlCon);
							});
							generPageBar("BindData", curPageIndex, totalPage,
									total);
						}
					}
					
					
				},
				error : function() {
					alert("网络错误！");
				}
			});
		}
		
		//新建文件夹的页面
		function f_openfolder()
	       {
	           $.ligerDialog.open({
	               height:300,
	               width: 400,
	               title : '新建文件夹',
	               url: '${pageContext.request.contextPath}/admin-users/tocreatefolderpage', 
	               showMax: false,
	               showToggle: true,
	               showMin: false,
	               isResize: true,
	               slide: false,
	               data: {
	                   selFolder:$('#selFolder').val()
	               },
	               //自定义参数
	               myDataName: $("#txtValue").val()
	           });
	       } 
		
			//到上传文件的页面
			function f_upload(){
	    	   $.ligerDialog.open({
	               height:400,
	               width: 600,
	               title : '请选择文件',
	               url: '${pageContext.request.contextPath}/fileupload/touploadpage', 
	               showMax: false,
	               showToggle: true,
	               showMin: false,
	               isResize: true,
	               slide: false,
	               closeable:false,
	               data: {
	                   selFolder:$('#selFolder').val()
	               },
	               //自定义参数
	               myDataName: $("#txtValue").val()
	           });
	       }
		
	</script>
</html>
